From dcfa55ac7e119f8ae8e5670291fdd20968fc5a58 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Tue, 17 Mar 2015 17:59:15 +0100 Subject: [PATCH] wayland: Fix thinko in wl_data_source.cancelled handler The wl_data_source may be the clipboard's. Looking up the drag context in order to get the display isn't going to fare well there. So, just use the default display, and only look up the drag context when we know we need it. https://bugzilla.gnome.org/show_bug.cgi?id=746386 --- gdk/wayland/gdkselection-wayland.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/gdk/wayland/gdkselection-wayland.c b/gdk/wayland/gdkselection-wayland.c index 39a5f22c19..651785a3ed 100644 --- a/gdk/wayland/gdkselection-wayland.c +++ b/gdk/wayland/gdkselection-wayland.c @@ -668,16 +668,19 @@ data_source_cancelled (void *data, g_debug (G_STRLOC ": %s source = %p", G_STRFUNC, source); - context = gdk_wayland_drag_context_lookup_by_data_source (source); - display = gdk_window_get_display (context->source_window); + display = gdk_display_get_default (); if (source == wayland_selection->dnd_source) - gdk_wayland_selection_unset_data_source (display, atoms[ATOM_DND]); + { + gdk_wayland_selection_unset_data_source (display, atoms[ATOM_DND]); + + context = gdk_wayland_drag_context_lookup_by_data_source (source); + + if (context) + gdk_wayland_drag_context_undo_grab (context); + } else if (source == wayland_selection->clipboard_source) gdk_wayland_selection_unset_data_source (display, atoms[ATOM_CLIPBOARD]); - - if (context) - gdk_wayland_drag_context_undo_grab (context); } static const struct wl_data_source_listener data_source_listener = { -- 2.30.2